package com.ymatou.iapi.dguser.service;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.dguser.parameter.UserBindDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;

import java.util.List;

/**
*获取unionId绑定列表Call
*FreeMaker Template自动生成代码
*/
public class UnionIdInfoCall extends YmatouBaseCall{
	private static String opurl ="bindinfo/unionid";
	
	public UnionIdInfoCall() {
		super(EnvSetup.getSystemUrl("dguser_iapi"),opurl,"GET","PARAM");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	public List<UserBindDto> getUserBindDtos(){
		String sResults=getJsonObject().get("userBindDtos").getAsJsonArray().toString();
		List<UserBindDto> UserBindDtos=(List<UserBindDto>) FormatUtil.GSONToObject(sResults, new TypeToken<List<UserBindDto>>(){}.getType());
		return UserBindDtos;
	}
}